﻿Namespace Client.Channel
    <Serializable()> _
    Public Structure BanListItem
        Dim User As String
        Dim HostMask As String
        Dim Channel As String
        Dim BannedBy As String
    End Structure
    <Serializable()> _
    Public Structure UserModeCmbItem
        Dim User As String
        Dim Mode As Connections.ModeEnum
        Dim Channel As String
    End Structure
    <Serializable()> _
    Public Structure ChannelItem
        Dim Name As String
        Dim ChanObj As Client.Channel.IRCChannel
    End Structure
    <Serializable()> _
    Public Class Channels
        Inherits CollectionBase
        Dim Stuff As Integer
        Event FeedAddedSuccessfully()
        Default Public Property Item(ByVal index As Integer) As ChannelItem
            Get
                Return CType(List(index), ChannelItem)
            End Get
            Set(ByVal Value As ChannelItem)
                List(index) = Value
            End Set
        End Property
        Public Function Add(ByVal value As ChannelItem) As Integer
            If IsNothing(Find(value.Name).ChanObj) Then Return List.Add(value)
        End Function
        Public Function IndexOf(ByVal value As ChannelItem) As Integer
            Return List.IndexOf(value)
        End Function
        Public Sub Insert(ByVal index As Integer, ByVal value As ChannelItem)
            List.Insert(index, value)
        End Sub
        Public Sub Remove(ByVal value As ChannelItem)
            List.Remove(value)
        End Sub
        Public Function Contains(ByVal value As ChannelItem) As Boolean
            Return List.Contains(value)
        End Function
        Public ReadOnly Property GetFirstItem() As ChannelItem
            Get
                Return Me.List(0)
            End Get
        End Property
        Function Find(ByVal itemTitle As String) As ChannelItem
            Try
                Dim ItemReturn As New ChannelItem
                Dim Item As New ChannelItem
                For Each Item In Me.List
                    Dim A As String = Item.Name
                    If LCase(Item.Name) = LCase(itemTitle) Then
                        ItemReturn = Item
                        Return ItemReturn
                        Exit For
                    End If
                Next
            Catch ex As Exception
                MsgBox(ex.ToString)
            End Try
            Return Nothing
        End Function
    End Class
    <Serializable()> _
    Public Class BanList
        Inherits CollectionBase
        Dim Stuff As Integer
        Event FeedAddedSuccessfully()
        Default Public Property Item(ByVal index As Integer) As BanListItem
            Get
                Return CType(List(index), BanListItem)
            End Get
            Set(ByVal Value As BanListItem)
                List(index) = Value
            End Set
        End Property
        Public Function Add(ByVal value As BanListItem) As Integer
            Return List.Add(value)
        End Function
        Public Function IndexOf(ByVal value As BanListItem) As Integer
            Return List.IndexOf(value)
        End Function
        Public Sub Insert(ByVal index As Integer, ByVal value As BanListItem)
            List.Insert(index, value)
        End Sub
        Public Sub Remove(ByVal value As BanListItem)
            List.Remove(value)
        End Sub
        Public Function Contains(ByVal value As BanListItem) As Boolean
            Return List.Contains(value)
        End Function
        Public ReadOnly Property GetFirstItem() As BanListItem
            Get
                Return Me.List(0)
            End Get
        End Property
        Function Find(ByVal Username As String) As BanListItem
            Try
                Dim ItemReturn As New BanListItem
                Dim Item As New BanListItem
                For Each Item In Me.List
                    Dim A As String = Item.User
                    If LCase(Item.User) = LCase(Username) Then
                        ItemReturn = Item
                        Return ItemReturn
                        Exit For
                    End If
                Next
            Catch ex As Exception
                MsgBox(ex.ToString)
            End Try
            Return Nothing
        End Function
    End Class
End Namespace